home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
jazclib1.arc
/
INDEX.C
< prev
next >
Wrap
Text File
|
1986-05-07
|
746b
|
26 lines
/*
┌────────────────────────────────────────────────────────────────────────────┐
│index.c │
│Return the index (pos) of a char in a string or -1 if not found │
│Usage: │
│ int result; │
│ │
│ if ( (result = index("filename.ext",'.')) == -1) │
│ printf("No extension was specified"); │
│ │
│ (C) JazSoft Software by Jack A. Zucker (301) 794-5950 │
└────────────────────────────────────────────────────────────────────────────┘
*/
index(s,c)
char *s,c;
{
unsigned int i = (unsigned int) s + 1;
while (*s)
if (*s++ == c)
return((unsigned int) s - i);
return(-1);
}